package cn.edu.xmist.thread;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

/**
 * @author zhongjinbin (jinbin.zhong@nascent.cn)
 * @version 1.0.0
 * @date 2021/1/8 14:04
 * @description com.fgood.thread
 */
public class ExecutorRunnableTest {

    public static void main(String[] args) {
        //
        ExecutorService executorService = Executors.newCachedThreadPool();
        for (int i = 0; i < 5; i++) {
            executorService.execute(new TestRunnable());
            System.out.println("******* " + i + " *******");
        }
        executorService.shutdown();
    }
}

class TestRunnable implements Runnable {

    @Override
    public void run() {
        System.out.println(Thread.currentThread().getName() + "线程被调用了");
    }
}
